<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset="utf-8">
<title>广告管理</title>
<@fm.header />
<style>
.provinceClass label {
	font-size: 12px;
	float:left;
	margin:2px;
	width:80px;
	height:20px;
}
</style>
</head>
<body>
<div class="easyui-layout" style="text-align: center; height: 270px;" fit="true">
	<div region="center" border="false" style="padding: 10px; background: #fff; border: 1px solid #ccc;">
	<form id="ff" method="post" enctype="multipart/form-data">
	<input type="hidden" name="isUseful"   value=${ad.isUseful}></input>
	<input type="hidden" name="id"   value=${ad.id}></input>
	    <table>
	        <tr>
	            <td><label for="name">名称:</label></td>
	            <td><input class="easyui-validatebox" type="text" name="name" style="width:300px" data-options="required:true,validType:'name'"  value=${ad.name} ></input></td>
			</tr>
			<tr>
	            <td><label for="url">连接:</label></td>
	            <td><input class="easyui-validatebox" type="text" name="url" style="width:300px" data-options="required:true,validType:'url'" value=${ad.url}  ></input></td>
	        </tr>
	        <tr>
	            <td><label for="daylimit">日限:</label></td>
	            <td><input class="easyui-validatebox" type="text" name="daylimit" style="width:300px" data-options="required:true,validType:'length[1,25]'" value=${ad.daylimit}  ></input></td>
	        </tr>
	        <tr>
	            <td><label for="clickratio">点显比:</label></td>
	            <td><input class="easyui-validatebox" type="text" name="clickratio" style="width:300px" data-options="required:true,validType:'length[1,25]'" value=${ad.clickratio}  ></input></td>
	        </tr>
	        <tr>
	            <td><label for="type">分组:</label></td>
	            <td> <select class="easyui-combobox" name="type" panelHeight="auto" style="width:155px"  value=${ad.type} data-options="required:true">
		                <option value="1"<#if ad.type?exists && ad.type == 1>selected</#if>>分组1</option>
	                	<option value="2"<#if ad.type?exists && ad.type == 2>selected</#if>>分组2</option>
	                	<option value="3"<#if ad.type?exists && ad.type == 3>selected</#if>>分组3</option>
	                	<option value="4"<#if ad.type?exists && ad.type == 4>selected</#if>>分组4</option>
	                	<option value="5"<#if ad.type?exists && ad.type == 5>selected</#if>>分组5</option>
	                	<option value="6"<#if ad.type?exists && ad.type == 6>selected</#if>>分组6</option>
	                	<option value="7"<#if ad.type?exists && ad.type == 7>selected</#if>>分组7</option>
	                	<option value="8"<#if ad.type?exists && ad.type == 8>selected</#if>>分组8</option>
	                	<option value="9"<#if ad.type?exists && ad.type == 9>selected</#if>>分组9</option>
	                	<option value="10"<#if ad.type?exists && ad.type == 10>selected</#if>>分组10</option>
		            </select></td>
	        </tr>
	    </table>
	</form>
	</div>
	<div region="south" border="false" style="text-align: center; padding: 5px 5px 5px 0;">
	    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="edit()">提交</a>
	</div>
</div>

<script>
	
function edit() {
	
	$('#ff').form(
	    'submit',
	    {
			url : '/ad/update',
			onSubmit : function() {
				return $(this).form('enableValidation').form('validate');
			},
			success : function(data) {
				showProcess(false);
				var data = eval('(' + data + ')');
				if (data.return_code == '1') {
					top.showMsg(market.content.title, data.return_msg, alert);
					if (parent !== undefined) {
						if ($.isFunction(parent.reloadParent)) {
							parent.reloadParent.call();
							parent.closeMyWindow();
						} else {
							parent.$("#tt").datagrid('reload');
							parent.closeMyWindow();
						}
					}
				}else if(data.return_code == '10'){
					$.messager.alert(market.content.title, data.return_msg);
					if (parent !== undefined) {
						if ($.isFunction(parent.reloadParent)) {
							parent.reloadParent.call();
							parent.closeMyWindow();
						} else {
							parent.$("#tt").datagrid('reload');
							parent.closeMyWindow();
						}
					}
				} else {
					$.messager.alert(market.content.title, data.return_msg);
				}
			},
			onLoadError : function() {
				showProcess(false);
				$.messager.alert(market.content.title, market.content.networkError);
			}
		}); 
}
</script>
</body>
</html>